[ResponseOps][Alerting v2] Move episodes time filter inside query, include previous actions - #290452
Conversation
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
|
Pinging @elastic/response-ops (Team:ResponseOps) |
…uery-time-filter-ignores-previous-actions
💔 Build Failed
Failed CI StepsMetrics [docs]Async chunks
Page load bundle
History
|
| bool: { | ||
| should: [ | ||
| { bool: { filter: [{ term: { type: 'alert' } }, rangeFilter.query] } }, | ||
| { exists: { field: 'action_type' } }, |
There was a problem hiding this comment.
Just to confirm, the action is unbounded on both sides, not only before the range. Thats the idea?
For a historical window (e.g. yesterday 14:00–15:00), we see the current status(action whatever) and not the status at the time 🤔
There was a problem hiding this comment.
Yes. I don't know what's the best approach here to be honest... Showing older action info, while the user might expect to see the latest state? The reverse? Or even exclude episodes don't have rule-events anymore now, even if they had them in the time window? I'm leaning towards the more up to date info.
For sure the current status is currently not visible since we take that from the last rule-event we see in the interval, so if the user manually resolved an active alert, it still shows as active in an older time window. We could enqueue an improvement on this, and maybe show a separate indication for "in this time range" vs "now"
| query, | ||
| input, | ||
| abortSignal, | ||
| timeField: DEFAULT_TIME_FIELD, |
There was a problem hiding this comment.
Tag options still go through timeField + input.timeRange, so the dropdown only sees tag actions inside the picker range.
After this change, the list row can show a tag whose action is before the range, but won't that value be missing from the combo box?
There was a problem hiding this comment.
You're absolutely right, I missed this one. Fixed!
📄 Summary
Important
Alerting v2 work under feature flag disabled by default. See 🧪 Verification steps > ⚙️ Environment Setup for more information.
≥ 14 min, with a tooltip) when the episode started before the range, sincefirst_timestampcannot be outside the range. The flyout still shows the full value.🧪 Verification steps
⚙️ Environment Setup
Add the following flag to your
kibana.dev.yml:Then navigate to Stack Management > Advanced settings > Global, and enable Alerting v2
You need an episode that has been active for a while (i.e. more than an hour), with a tag and an ack added shortly after it started.
✅ Happy Path
Last 15 minutesselected≥followed by the duration seen inside the range, and hovering it explains why≥goes away and the duration becomes the full one⚡️ Edge Cases
≥row: it shows the full duration and the same tags and ack🐞 Known issues & potential improvements
pending_count: 0skip thependingstate, so when no earlier episode of the same series is in range we can't tell whether we saw the start, and the row shows≥even when the duration is exact.$.alert-episodesview has the same aggregation shape and Discover pushes its own range down, so the profile is not covered by this change.🧰 Implementation details
The range is sent as a request filter (
bool.should: [type == "alert" AND range, exists(action_type)]) throughinput.filtersinstead of theesqlfunction'stimeField, so ES still bounds the.rule-eventsscan at the Lucene level and every.alert-actionsdoc passes. Measured on 2M events at 12h: 0.18s vs 0.11s before.I first tried selecting the episodes in range with an
IN (subquery)and aggregating their full history (@adcoelho's suggestion), to fix the duration too. ES does not push the subquery down: 28s on the same data. A literal id list is pushed down (0.3s), but that means two requests.📷 Screenshots
⏪ Backport rationale
Alerting v2 pre-GA work, not backporting
🔗 References
Fixes https://github.com/elastic/rna-program/issues/1030
☑️ Checklist
backport:*labels.